<?php
namespace app\home\controller;

use think\Request;
use think\Controller;

class Index extends Controller
{
    public function index()
    {
        $request = request();
        $param = $request->param();
        dump($param);
        echo "你的名字是:".$param['name'];
        // return '';
    }

    // http://localhost:8888/home/index/read/id/1000
    // // http://localhost:8888/home/index/read?id=1000
    public function read($id){ 
        dump($id);
    }

    public function yilaizhuru(Request $request) {
        dump($request->param());
    }

    public function testjson() {
        // app('json');
        return json(["age"=>23]);
    }

    public function edit() {
        $user = ['username'=>"zhangsan"];
        $this->assign(compact('user'));
        return view();// 助手函数
    }
}
